#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
#include<queue>
using namespace std;
class Solution {
public:
    bool backspaceCompare(string s, string t) {
        string s1, s2;
        for (auto ch : s)
        {
            if (s1.size() && ch == '#') s1.pop_back();
            else if (ch != '#') s1.push_back(ch);
        }
        for (auto ch : t)
        {
            if (s2.size() && ch == '#') s2.pop_back();
            else if (ch != '#') s2.push_back(ch);
        }
        return s1 == s2;
    }
};
int main() {
    return 0;
}